package com.foodconflict.action;

import java.util.ArrayList;
import java.util.List;

import com.foodconflict.domain.Conflict;
import com.foodconflict.service.ConflictService;
import com.foodconflict.util.ActionBase;
import com.foodconflict.util.PagedData;
import com.foodconflict.util.PagedResult;

public class ConflictListAction extends ActionBase {
	private ConflictService conflictService;
	private PagedData pageData;
	private int pageindex;
	private List<Conflict> conflictList;

	public ConflictService getConflictService() {
		return conflictService;
	}

	public void setConflictService(ConflictService conflictService) {
		this.conflictService = conflictService;
	}
	
	public PagedData getPageData() {
		return pageData;
	}

	public void setPageData(PagedData pageData) {
		this.pageData = pageData;
	}

	public int getPageindex() {
		return pageindex;
	}

	public void setPageindex(int pageindex) {
		this.pageindex = pageindex;
	}

	public List<Conflict> getConflictList() {
		return conflictList;
	}

	public void setConflictList(List<Conflict> conflictList) {
		this.conflictList = conflictList;
	}

	public String listAll()
	{
		PagedResult<Conflict> pr = conflictService.findConflictList(pageindex, 20);
		conflictList = pr.getResultList();
		pageData = pr.getPagedData();
		pageindex =pageData.getPageindex();

		return success("listAll");
	}
}
